Passed
Push — main ( 6bd289...c1f636 )
by Pieter Epeüs
57s queued 12s
created

multikey.js ➔ multikey   A

Complexity

Conditions 4

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 15
rs 10
c 0
b 0
f 0
cc 4
1
export default function multikey(original, key) {
2
    return original.map((value) => {
3
        const item = {};
4
5
        if (typeof key === 'object') {
6
            key.forEach((itemKey) => {
7
                item[itemKey] = value[itemKey];
8
            });
9
10
            return item;
11
        }
12
13
        return value[key];
14
    });
15
}
16